package com.sniff.atp.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

public class FastUtil {

    private FastUtil(){}

    public static <T> T toBean(Object json, TypeReference<T> type) {
        return JSON.parseObject(JSON.toJSONString(json), type);
    }

    public static <T> T toBean(Object json, Class<T> clazz) {
        return JSON.parseObject(JSON.toJSONString(json), clazz);
    }

    public static <T> T toBean(Object json) {
        return JSON.parseObject(JSON.toJSONString(json), new TypeReference<T>(){});
    }
}
